-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added new AVP::AnimationOptimization property #6269
Added new AVP::AnimationOptimization property #6269
Conversation
auto clampedProgress = std::clamp(static_cast<float>(progress), 0.0F, 1.0F); | ||
|
||
// WARNING: Reentrance via IsPlaying DP may occur from this point down to the end of the method | ||
// iff m_nowPlaying. | ||
|
||
// Setting the Progress value will stop the current play. | ||
m_progressPropertySet.InsertScalar(L"Progress", static_cast<float>(clampedProgress)); | ||
m_lastPlayProgress = progress; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, probably it is better to set it to clampedProgress
here, thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -62,6 +88,9 @@ unsealed runtimeclass AnimatedVisualPlayer | |||
[MUX_DEFAULT_VALUE("true")] | |||
[MUX_PROPERTY_CHANGED_CALLBACK(TRUE)] | |||
Boolean AutoPlay; | |||
[MUX_DEFAULT_VALUE("winrt::AnimationsCacheModeEnum::Always")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would need to version these APIs since you are adding to an existing type. See MUX_PUBLIC_V2 to see how it is done in other types. @kmahone as FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done
…layer2 because it was not doing so due to the DeriveFromPanelHelper_base implementation.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
if (m_owner) | ||
{ | ||
// If optimization is set to Resources - destroy animations immediately after player stops. | ||
if (m_owner->AnimatedVisualPlayerProperties::AnimationOptimization() == winrt::PlayerAnimationOptimization::Resources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…into user/aborziak/new-avp-api
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
} | ||
|
||
// Call RequestCommit to make sure that previous compositor calls complete before destroying animations. | ||
m_rootVisual.Compositor().RequestCommitAsync().Completed( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RequestCommitAsync() is only available on Rs4+ we need to gracefully handle the case where this API isn't available on RS2 and RS3.
{ | ||
return; | ||
} | ||
|
||
// Call RequestCommit to make sure that previous compositor calls complete before destroying animations. | ||
// RequestCommitAsync is available only for RS4+ but m_animatedVisual is not null guarantees that we are at least RS5+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this the case? Don't the visuals get created at startup? and then I could call destroy animations on this and hit this code path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Destroy and Create are private inside AVP, we are exposing only AnimationOptimization property
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Description
In this change we are adding AnimationOptimization property to the AnimatedVisualPlayer. This property has two possible values:
Resources
orLatency
(default).When animation is completed and optimization mode is set to
Resources
we will destroy all the windows composition animations from the lottie side. When we call PlayAsync or SetProgress we will re-instantiate all the animations again.If optimization mode is set to
Latency
we will immediately instantiate all the animations and will keep them even if AVP is not playing anything.Also in order to expose this functionality from LottieGen side we need to add IAnimatedVisual and IAnimatedVisualSource3 interfaces that are used only by AVP.
Motivation and Context
There are some performance issues with the current implementation of LottieGen and AnimatedVisual Player:
The Idle (paused) lottie animations use the same amount of CPU resources as when they are playing the actual animation.
#6268